package com.study.spark.scala.chapter07


object Scala03_Collection{
  def main(args: Array[String]): Unit = {
    // TODO 集合 - 常用方法
    val array = Array(1,2,3,4,4)
    println(array.size)//5
    println(array.length)//5
    println(array.isEmpty)//false
    println(array.contains(2))//true
    println(array.distinct.mkString(","))//1,2,3,4
    println(array.reverse.mkString(","))//4,4,3,2,1

    // 遍历
    println(array.mkString("%"))//1%2%3%4%4
    array.foreach(println)
    /*
    1
    2
    3
    4
    4
     */
    println(array.iterator)//<iterator>

  }
}
